#pragma once
#ifdef LIT_OGRE_SUPPORT
#ifndef __LIT__OGRE__STATE__HH__
#define __LIT__OGRE__STATE__HH__

#include <LitOgreDetails.h>
#include <LitListener.h>
#include <LitInitialiser.h>

#include <LitPrerequisites.h>

namespace Lit
{
	class LIT_API Initialiser;

	/** States a.k.a OgreDetails are Ogre Main Variables 
		\see OgreDetails
		\see Ogre::RenderWindow
		\see Ogre::SceneManager
		\see Ogre::Camera
		\see OgreManager::getCurrentState
		\see OgreManager::pushState
		\see OgreManager::popState
		\remarks 
			You can push states to create InGame cinematics, where you'll have to switch camera's etc
			It isn't mandatory as OgreManager will push a first state for you when initialised
	*/
	class LIT_API OgreState : public Initialiser
	{
	protected:
		OgreDetails mDetails;

	public:
		OgreState( const String &name = "", OgreRenderWindowPtr window = OgreRenderWindowPtr() ) ;
		OgreState( const OgreState &rk );
		virtual ~OgreState();
		
		OgreState& operator=( const OgreState &rk );

		virtual bool renderOneFrame( float dt ) = 0;
		virtual void createScene() = 0;
		virtual void destroyScene() = 0;

		OgreDetails& details();
		const OgreDetails& details() const;
	};
	
	/**	The basic state OGRE is in after being initialised,
		meaning that it has got the main Ogre::SceneManager,
		Ogre::Camera and Ogre::RenderWindow variables
	*/
	class LIT_API OgreInitialState : public OgreState
	{
		String mCameraName;

		void createViewport(OgreCameraPtr cam, int zOrder, float left = 0.0f, float top = 0.0f, float width = 1.0f, float height = 1.0f );
	public:
		OgreInitialState( const String & cam_name="MainCamera", OgreRenderWindowPtr window = OgreRenderWindowPtr() ) ;
		OgreInitialState( const OgreInitialState &rk );
		virtual ~OgreInitialState();
		
		OgreInitialState& operator=( const OgreInitialState &rk );
		
		virtual bool renderOneFrame( float dt );
		virtual void createScene( );
		virtual void destroyScene();
	};

	typedef RefPtr<OgreState>					OgreStatePtr;
	typedef RefPtr<OgreInitialState>			OgreInitialStatePtr;
};

#endif
#endif